package club.babyf.nativeai.demo.enums;

/**
 * Operation.
 *
 * @author zhanglei.
 * @date 2025/3/24 11:18.
 * @description 操作枚举.
 */
public enum Operation {

    ADD {
        @Override
        public double apply(double x, double y) {
            return x + y;
        }
    },

    SUBTRACT {
        @Override
        public double apply(double x, double y) {
            return x - y;
        }
    },

    MULTIPLY {
        @Override
        public double apply(double x, double y) {
            return x * y;
        }
    },

    DIVIDE {
        @Override
        public double apply(double x, double y) {
            return x / y;
        }
    }

    ;

    public abstract double apply(double x, double y);

    public static void main(String[] args) {
        double x = 2;
        double y = 4;
        System.out.println("Addition：" + Operation.ADD.apply(x, y));
        System.out.println("Subtraction：" + Operation.SUBTRACT.apply(x, y));
    }

}
